#ifndef _HOOK_PROC_LIB_H_
#define _HOOK_PROC_LIB_H_

#include <string>
#include <map>

#include <boost/shared_ptr.hpp>
#include <boost/serialization/singleton.hpp>

namespace sd
{
namespace hp
{
namespace impl
{
class LibraryImpl;
}

class Library
{
public:
	Library( const Library& ref );
	Library( const std::string& name );
	impl::LibraryImpl* getImpl(){ return impl_.get(); }
	const std::string& getName()const;
	Library& operator=( const Library& ref );
private:
	Library(){}
	boost::shared_ptr< impl::LibraryImpl > impl_; 
};

typedef Library& LibraryRef;


class LibraryManager : public boost::serialization::singleton<LibraryManager>
{
public:
	LibraryRef& getLibrary( const std::string& name )
	{
		LibrariesMap::iterator it = libraries_.find( name );
		if( it == libraries_.end() )
			it = libraries_.insert( std::make_pair( name, Library( name ) ) ).first;
		return it->second;

	}
private:
	typedef std::map<std::string, Library> LibrariesMap;
	LibrariesMap libraries_;
};





}// namespace hp
}// namespace sd

#endif//_HOOK_PROC_LIB_H_